-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] 핀 클릭 시 번개 목록 API 연동 #101
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생했어요오
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
집에 가서 마저 달겠음..
import org.sopt.pingle.util.base.BaseResponse | ||
|
||
interface MapRemoteDataSource { | ||
suspend fun getPinListWithoutFiltering(teamId: Long, category: String?): BaseResponse<List<ResponsePinListDto>> | ||
suspend fun getPinListWithoutFiltering( | ||
teamId: Long, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
근데 생각해보니까 아요가 Long 타입 없다고 하지 않았었나..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오잉 이거 서버에서 long으로 넘어오던뎅,, 그리고 아요 이미 서버 다 붙이긴 함요,,, 지도 부분
@@ -24,4 +25,16 @@ class MapRepositoryImpl @Inject constructor( | |||
} | |||
emit(result.getOrThrow()) | |||
} | |||
|
|||
override suspend fun getPingleList(teamId: Long, pinId: Long): Flow<List<PingleEntity>> = flow { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flow로 한 이유가 있나용?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flow로 방출한다면 이 루틴은 죽는 시점이 언제인가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기서 반환되는 플로우는 viewModelScope.launch 블록 내부에서 수집되게 됩니당. 그렇기 때문에 뷰모델이 소멸될 때 코루틴도 함께 취소되고 코루틴이 취소되면서 그 안에서 실행되고 있는 플로우도 자동으로 취소됩니다 즉, 뷰모델이 죽으면 플로우도 같이 죽어용 ㅋ
플로우로 한 이유는,, 플로우 한 번 써보고 싶어서요,,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
근데 이 루틴이 해당 블록 내에서 수행되는게 아니지 않나용?? 방출된게 수집되는 것이지
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
음,, 제가 질문을 제대로 이해한 게 맞는지 모르겠지만,, 이 함수의 결과값으로 플로우를 반환해주는 것이기 때문에 뷰모델 스코프 내부에서 플로우가 생성되고 종료되는 거라구 생각했습니당,,,
@@ -165,6 +165,21 @@ class MapFragment : BindingFragment<FragmentMapBinding>(R.layout.fragment_map), | |||
} | |||
} | |||
}.launchIn(lifecycleScope) | |||
|
|||
mapViewModel.pingleListState.flowWithLifecycle(lifecycle).onEach { uiState -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 emit 방식으로 한거면 flowWithLifeCylce 한 번 확인해보는게 좋을거 같습니당!! 물론 저희는 여러개의 루틴이 생길일이 있을 거 같진 않지만... 여러개의 루틴이 생기게 됐을때 최신값을 우선적으로 방출하는 아이가 맞는지 한 번 확인해주세용
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 확인안해도 될 거 같습니다 그대로 stateFLow군요 ㅋㅋ
@@ -24,4 +25,16 @@ class MapRepositoryImpl @Inject constructor( | |||
} | |||
emit(result.getOrThrow()) | |||
} | |||
|
|||
override suspend fun getPingleList(teamId: Long, pinId: Long): Flow<List<PingleEntity>> = flow { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flow로 방출한다면 이 루틴은 죽는 시점이 언제인가요?
import org.sopt.pingle.domain.model.PingleEntity | ||
import org.sopt.pingle.domain.repository.MapRepository | ||
|
||
class GetPingleListUseCase( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거랑 withOut..UseCase를 나눈 이유가 뭘까요?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
유즈케이스가 하나의 책임을 가지는 것이 좋다고 생각해서 나누었습니다
@@ -165,6 +165,21 @@ class MapFragment : BindingFragment<FragmentMapBinding>(R.layout.fragment_map), | |||
} | |||
} | |||
}.launchIn(lifecycleScope) | |||
|
|||
mapViewModel.pingleListState.flowWithLifecycle(lifecycle).onEach { uiState -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 확인안해도 될 거 같습니다 그대로 stateFLow군요 ㅋㅋ
Related issue 🛠
Work Description ✏️
Screenshot 📸
Screen_recording_20240111_122310.mp4
Uncompleted Tasks 😅
To Reviewers 📢